From: Florian Müllner Date: Fri, 23 Feb 2018 22:58:22 +0000 (+0100) Subject: volume: Only emit sound feedback after volume changes X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~781^2^2~374 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=6c8eb1a18ec0c35c82aebdbab5bd8926078e4d0f;p=gnome-shell.git volume: Only emit sound feedback after volume changes gnome-settings-daemon doesn't play the volume change sound when the volume stayed the same (that is, it is already at its maximum or minimum). This looks like the right thing to do, so copy its behavior. https://gitlab.gnome.org/GNOME/gnome-shell/issues/53 --- diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js index 48ae45a9a..87b24e04a 100644 --- a/js/ui/status/volume.js +++ b/js/ui/status/volume.js @@ -113,6 +113,7 @@ var StreamSlider = class { let value = this._slider.value; let volume = value * this._control.get_vol_max_norm(); let prevMuted = this._stream.is_muted; + let prevVolume = this._stream.volume; if (volume < 1) { this._stream.volume = 0; if (!prevMuted) @@ -124,7 +125,8 @@ var StreamSlider = class { } this._stream.push_volume(); - if (!this._notifyVolumeChangeId && !this._inDrag) { + let volumeChanged = this._stream.volume !== prevVolume; + if (volumeChanged && !this._notifyVolumeChangeId && !this._inDrag) { this._notifyVolumeChangeId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 30, () => { this._notifyVolumeChange(); this._notifyVolumeChangeId = 0;